package com.systemic.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @ClassName: WebMvcConfig
 * @Description: 解决跨域
 * @Author:
 * @CreateTime: 2024-02-04 07:58
 * @Version:
 **/
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")          // spring boot 2.4.1以上版本用 .allowedOriginPatterns("*")
                .allowedMethods("*")
                .allowCredentials(true);
    }

}
